#include "httpServer.hpp"
#include <memory>
#include "daemon.hpp"

void GET(const Request& req,Response& res){
    res.buildResponse(req.path,req.ext);
}

int main(int argc,char* args[]){
    if(argc != 2){
        std::cout<<"please using:/tcpserver port"<<std::endl;
        exit(1);
    }
    daemon();
    uint16_t port = atoi(args[1]);
    std::unique_ptr<tcpServer> s(new tcpServer(port,GET));
    s->initServer();
    s->start();

    return 0;
}